package edu.ynu.se.xiecheng.achitectureclass.dao;

import edu.ynu.se.xiecheng.achitectureclass.entity.SoilNitrogenData;
import edu.ynu.se.xiecheng.achitectureclass.entity.Device;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

@Repository
public interface SoilNitrogenRepository extends JpaRepository<SoilNitrogenData, Long> {
    Optional<SoilNitrogenData> findFirstByOrderByCreateTimeDesc();
    List<SoilNitrogenData> findByCreateTimeBetween(LocalDateTime start, LocalDateTime end);
    List<SoilNitrogenData> findByDeviceAndCreateTimeBetween(Device device, LocalDateTime start, LocalDateTime end);
} 